import { NextRequest, NextResponse } from 'next/server' import { prisma } from '@/lib/db' export const dynamic = 'force-dynamic' export async function GET( request: NextRequest, { params }: { params: Promise<{ id: string }> } ) { try { const { id } = await params const report = await prisma.report.findUnique({ where: { id } }) if (!report) { return NextResponse.json({ error: 'Report not found' }, { status: 404 }) } return NextResponse.json({ ...report, contentJson: JSON.parse(report.contentJson), }) } catch (error) { return NextResponse.json({ error: (error as Error).message }, { status: 500 }) } }